home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000058_icon-group-sender_Thu Mar 27 17:16:01 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2S0FrA08027
  4.     for icon-group-addresses; Thu, 27 Mar 2003 17:15:53 -0700 (MST)
  5. Message-Id: <200303280015.h2S0FrA08027@baskerville.CS.Arizona.EDU>
  6. From: voice_of_reason@australia.edu (Quiet Voice)
  7. X-Newsgroups: comp.lang.icon
  8. Subject: Befuddled by logic and an error message.....
  9. Date: 27 Mar 2003 14:18:29 -0800
  10. X-Complaints-To: groups-abuse@google.com
  11. To: icon-group@cs.arizona.edu
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. Greetings:
  16.  
  17. Still in my endeavor to "re-learn" ICON, I have hit upon a bug that is
  18. partially a logic bug and partially a runtime error.
  19.  
  20. What I am attempting to do is as follows --
  21.  
  22. A file is opened which contains text.
  23.  
  24. The idea of the program is to allow the user to selectively and
  25. iteratively edit and re-edit the file and see the edits alongside the
  26. original version of text.
  27.  
  28. The program creates and output file that holds the original text and
  29. the current state of editing.
  30.  
  31. A line from the original file along with the corresponding edited line
  32. are written to output.
  33.  
  34. With each pass thru the loop the idea is that the program opens a temp
  35. file that holds the current editing. The user is essentially
  36. iteratively editing the temp file.
  37.  
  38. Here's the code fragment along with comments I've written to
  39. myself....
  40.  
  41. target := current text
  42. edit := proposed edits
  43.   .
  44.   .
  45.   .
  46.  
  47. # LOGIC PROBLEM WITH THIS LOOP. NEED TO READ DATA FROM CURRENT GUESS
  48. *THEN* SAVE NEW GUESS FOR
  49. # FUTURE READ....but NEED TO PREVENT "INFINTIE LOOP" SITUATION OF
  50. READING THEN WRITING THEN READING>>>>ETC
  51.  
  52. # CURRENT VERSION RESULTS IN RUN-TIME ERROR: 214 (???) in line 88
  53.  
  54. while (line := read(temp_holder)) do
  55.               {
  56.            orig := read(orig_text)
  57.                trial_line := map(line,target,edit)
  58.  
  59.                write(output,"original: ",orig)
  60.                write(output," ")
  61.                write(output,"new:      ",trial_line)
  62.                write(output," ")
  63.  
  64. OFFENDING LINE OF CODE  ==> write(temp_holder,trial_line)   # save
  65. current trial set
  66.                 }
  67.  
  68. write("TRIAL CORRECTIONS WRITTEN TO TEMPORARY FILE.")
  69. writes("Do you have more corrections? Type yes or no: ")
  70. more := read()
  71.  
  72. } #end INPUT loop
  73.  
  74.  
  75. ---
  76. First of all, what sort of situations create a runtime error 214? What
  77. am I doing wrong?
  78.  
  79. Secondly, any suggestions on how better to accomplish this?
  80.  
  81. Thanks for the advice and assitance.....
  82.